
/* 左侧效果提交 */
$(function(){
     var jLi = $('.j_Li'),
         jA = $('.jA_1'),
         jDetails = $('.j_detail')

    for(var i =0;i<jLi.length;i++){
        jLi[i].index = i;
        jLi[i].onmouseover = function(){
            jA[this.index].style.display ='none',
            jDetails[this.index].style.position = 'relative'
            jDetails[this.index].style.transition = 'all 1s'
            jDetails[this.index].style.top = '0px'
        }
        jLi[i].onmouseout = function(){
            jA[this.index].style.display ='block',
            jDetails[this.index].style.transition = 'all 0s'
            jDetails[this.index].style.position = 'absolute'
            jDetails[this.index].style.top = '-500px'
        }
    }
})

/* 固定订单栏title */
$(function () {
    //滚动条的事件绑定
    $(window).scroll(function () {
        // 如果document向上卷曲出去的高度 >= 导航栏的高度,则给导航栏设置固定定位,top=0
       if($(document).scrollTop() >=  $(".navTop").height()){
            $("#l_gendan_title").css({"position":"fixed","top":"0","zIndex":"10"});
       }else{
            $("#l_gendan_title").css({"position":"static"});
       }
    });
});



/*第三区域柱状图 日报表*/
$(function () {
    //y:手数，k：笔数，totals:总笔数
    // profitsObj = {};
    // profitsObj.buyOrders = {};
    // profitsObj.sellOrders = {};
    // profitsObj.time = {};
    // profitsObj.time =['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'];
    // profitsObj.buyOrders =[{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':0},{'k':3,'y':0.03,'totals':4},{'k':2,'y':0.1,'totals':2},{'k':0,'y':0,'totals':0},{'k':13,'y':0.41,'totals':13},{'k':21,'y':0.62,'totals':24},{'k':54,'y':0.71,'totals':54},{'k':20,'y':0.6,'totals':21},{'k':69,'y':2.38,'totals':72},{'k':12,'y':0.16,'totals':12},{'k':0,'y':0,'totals':0},{'k':17,'y':0.17,'totals':18},{'k':22,'y':0.5,'totals':22},{'k':34,'y':0.43,'totals':37},{'k':48,'y':0.67,'totals':55},{'k':58,'y':1.43,'totals':64},{'k':11,'y':0.34,'totals':11},{'k':0,'y':0,'totals':0},{'k':26,'y':1,'totals':26},{'k':60,'y':2.84,'totals':63},{'k':32,'y':0.35,'totals':36},{'k':24,'y':0.26,'totals':30},{'k':13,'y':0.15,'totals':22},{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':0},{'k':26,'y':0.34,'totals':35},{'k':47,'y':1.07,'totals':57},{'k':21,'y':0.66,'totals':36},{'k':22,'y':0.57,'totals':24}];
    // profitsObj.sellOrders =[{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':0},{'k':1,'y':0.01,'totals':4},{'k':0,'y':0,'totals':2},{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':13},{'k':3,'y':0.03,'totals':24},{'k':0,'y':0,'totals':54},{'k':1,'y':0.01,'totals':21},{'k':3,'y':0.07,'totals':72},{'k':0,'y':0,'totals':12},{'k':0,'y':0,'totals':0},{'k':1,'y':0.01,'totals':18},{'k':0,'y':0,'totals':22},{'k':3,'y':0.03,'totals':37},{'k':7,'y':0.07,'totals':55},{'k':6,'y':0.06,'totals':64},{'k':0,'y':0,'totals':11},{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':26},{'k':3,'y':0.11,'totals':63},{'k':4,'y':0.04,'totals':36},{'k':6,'y':0.06,'totals':30},{'k':9,'y':0.13,'totals':22},{'k':0,'y':0,'totals':0},{'k':0,'y':0,'totals':0},{'k':9,'y':0.14,'totals':35},{'k':10,'y':0.27,'totals':57},{'k':15,'y':0.49,'totals':36},{'k':2,'y':0.04,'totals':24}];


    var data7 = {
                title : '日交易笔数',
                time : profitsObj.time,
                data : [
                    { name: '买入', data: profitsObj.buyOrders },
                    { name: '卖出', data: profitsObj.sellOrders }
                ]

            }
    drawChartR(zhuBar,data7);
    // drawChartR(zhuBar3,data7);
});
// 日报表
function drawChartR(id,data){
    var lineColor= ['#00a8ee','#f7512b'];
    var colors = ['#b6eaff','#fdd5d5'];
    var hoverColors = ['rgba(255,174,60,0.6)','rgba(124,183,255,0.6)'];
    for (var i = 0;i<data.data.length;i++) {
        data.data[i]=$.extend(true, data.data[i],{
            color:colors[i],
            borderColor:lineColor[i],
            states:{
                hover:{
                    color:hoverColors[i]
                }
            }
        });
    }
    // console.log(data)
    return new Highcharts.Chart({
        chart: {
            type: 'column',
            renderTo: id
        },
        title: {
            text: '',
            align: 'left',
            style: {
                fontSize: 14
            }
        },  
        colors: colors,
        credits: {
            enabled: false
        },
        exporting:{
            enabled: false
        },
        xAxis: {
            categories: data.time,
            // tickPositions: [ 1, 2 , 3 , 4, 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 ],
            // tickInterval: Math.ceil(data.time.length / 7),
            gridLineWidth: 0,
            // tickWidth: 16,
            labels: {
                autoRotation: false,
                style: {
                    fontSize: 14
                }
            }
        },
        yAxis: {
            min: 0,
            tickPositions: [0, 5, 10, 15 , 20 , 25 ,30],
            tickAmount: 7,
            title: {
                text: ''
            },
            labels: {
                autoRotation: false,
                style: {
                    fontSize: 14
                }
            }
        },
        legend: {
        },
        plotOptions: {
            column: {
                stacking: 'normal',
                pointWidth: 6
            }
        },
        tooltip: {
            formatter:function(){
                // var s=this.x+' '+this.series.name+' '+this.y+' 手/'+this.point.k+' 笔'+'，总数 '+this.point.total+' 手/'+this.point.totals+' 笔';
                var s=this.series.name+'：'+this.y+' 单，盈亏：'+this.point.k+' 点';
                return s;
            }
            
        },
        series:data.data
    });
}
